//删除的id
$('#startTime').datetimepicker({
	minView: "month",
	language: 'zh-CN',
	format: 'yyyy-mm-dd',
	todayBtn: 1,
	autoclose: true
});
$('#endTime').datetimepicker({
	minView: "month",
	language: 'zh-CN',
	format: 'yyyy-mm-dd',
	todayBtn: 1,
	autoclose: true
});
var oprateUrl = DOMAIN + '/v1/warehouseOutInfo' + isLogin;
function loadTable() {
	$("#table").bootstrapTable({ // 对应table标签的id
		url: oprateUrl,
		method: 'get',
		cache: false,
		striped: true,
		pagination: true,
		pageSize: 50,
		pageNumber: 1,
		pageList: [50,100],
		search: false,
		showColumns: false,
		clickToSelect: true,
		queryParams: {
			deleteFlg: 0
		},
		smartDisplay: false,
		columns:[ {
			field: "outCode",
			title: "出库单号",
			align: "center",
			valign: "middle",
			sortable: "true"
		},{
			field: "customerName",
			title: "客户名称",
			align: "center",
			valign: "middle",
			sortable: "true"
		}, {
			field: "saleNo",
			title: "销售订单号",
			align: "center",
			valign: "middle",
			sortable: "true"
		}, {
			field: "outDate",
			title: "出库日期",
			align: "center",
			valign: "middle",
			sortable: "true"
		}, {
			field: "createUser",
			title: "创建人",
			align: "center",
			valign: "middle",
			sortable: "true"
		}, {
			field: "productName",
			title: "产品名称",
			align: "center",
			valign: "middle",
			sortable: "true"
		}, {
			field: "productType",
			title: "产品类别",
			align: "center",
			valign: "middle",
			sortable: "true"
		}, {
			field: "grade",
			title: "产品级别",
			align: "center",
			valign: "middle",
			sortable: "true"
		}, {
			field: "units",
			title: "单位",
			align: "center",
			valign: "middle",
			sortable: "true"
		},{
			field: "price",
			title: "单价",
			align: "center",
			valign: "middle"
		}, {
			field: "amount",
			title: "订单数量",
			align: "center",
			valign: "middle",
			sortable: "true"
		}, {
			field: "deliverAmount",
			title: "出库数量",
			align: "center",
			valign: "middle",
			sortable: "true"
		}, {
			field: "money",
			title: "行金额",
			align: "center",
			valign: "middle"
		}/*,[
			{
				title: '出库：',
				align: 'center',
				valign: 'middle',
				//sortable : true,
				colspan:2,
				rowspan:1
			},
			{
				title: '________________',
				align: 'center',
				valign: 'middle',
				//sortable : true,
				colspan:2,
				rowspan:1
			},
			{
				title: '审核：',
				align: 'center',
				valign: 'middle',
				//sortable : true,
				colspan:2,
				rowspan:1
			},
			{
				title: '________________',
				align: 'center',
				valign: 'middle',
				//sortable : true,
				colspan:2,
				rowspan:1
			},
			{
				title: '收货：',
				align: 'center',
				valign: 'middle',
				//sortable : true,
				colspan:3,
				rowspan:1
			},
			{
				title: '________________',
				align: 'center',
				valign: 'middle',
				//sortable : true,
				colspan:2,
				rowspan:1
			}
		]*/],
		//>>>>>>>>>>>>>>导出excel表格设置
		showExport: true,
		showExport: true,
		//是否显示导出按钮
		buttonsAlign: "left",
		//按钮位置
		exportDataType: 'all',
		//导出的方式 all全部 selected已选择的  basic', 'all', 'selected'.
		Icons: 'glyphicon glyphicon-export',
		exportTypes: ['excel', 'doc', 'xlsx', 'txt',],
		//导出文件类型
		exportOptions: {
			//ignoreColumn: [0, 0],  //忽略某一列的索引，id删除更新用用，不显示与导出

			fileName: '销售出库单',
			//文件名称设置
			worksheetName: 'sheet1',
			//表格工作区名称
			tableName: '导出数据表',
			// excelstyles: ['background-color', 'color', 'font-size', 'font-weight'], 设置格式

		},
		//导出excel表格设置<<<<<<<<<<<<<<<<
		formatNoMatches: function () {
			return '没有找到匹配的记录';
		}
	});
}

//查询
$("#selectPurchaseBtn").click(function () {
	//新查询参数
	function queryParamNew(params) {
		var params = {};
		params.startTime = $("#startTime").val();
		params.endTime = $("#endTime").val();
		params.saleNo = $("#saleNo").val();
		params.outCode = $("#outCode").val();
		return params;
	};
	var url = DOMAIN + '/v1/warehouseOutInfo' + isLogin;
	$('#table').bootstrapTable(
		'refreshOptions',
		{
			url: url,
			//查询参数
			queryParams: queryParamNew
		}
	);
})

$(function(){
	time_rota2($("#startTime"));
	time_rota($("#endTime"));
	loadTable();
	//新查询参数
	function queryParamNew(params) {
		var params = {};
		params.startTime = $("#startTime").val();
		params.endTime = $("#endTime").val();
		params.saleNo = $("#saleNo").val();
		params.outCode = $("#outCode").val();
		return params;
	};
	var url = DOMAIN + '/v1/warehouseOutInfo' + isLogin;
	$('#table').bootstrapTable(
		'refreshOptions',
		{
			url: url,
			//查询参数
			queryParams: queryParamNew
		}
	);
});
